import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
} from '@nestjs/common';
import { DictItemService } from './dict-item.service';
import { CreateDictItemDto } from './dto/create-dict-item.dto';
import { UpdateDictItemDto } from './dto/update-dict-item.dto';
import { QueryDictItemDto } from './dto/query-dict-item.dto';

@Controller('dict-item')
export class DictItemController {
  constructor(private readonly dictItemService: DictItemService) {}

  @Post('create')
  create(@Body() createDictItemDto: CreateDictItemDto) {
    return this.dictItemService.create(createDictItemDto);
  }

  @Post('list')
  findAll(@Body() queryDictItemDto: QueryDictItemDto) {
    return this.dictItemService.findAll(queryDictItemDto);
  }

  @Get('find/:id')
  findOne(@Param('id') id: string) {
    return this.dictItemService.findOne(+id);
  }

  @Patch('update/:id')
  update(
    @Param('id') id: string,
    @Body() updateDictItemDto: UpdateDictItemDto,
  ) {
    return this.dictItemService.update(+id, updateDictItemDto);
  }

  @Delete('delete/:id')
  remove(@Param('id') id: string) {
    return this.dictItemService.remove(+id);
  }
}
